//
//  PersonalListTableViewCell.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/9/8.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "PersonalListTableViewCell.h"

@implementation PersonalListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _leftImg = [UIImageView new];
        _leftImg.image = IMAGE(@"");
        [self addSubview:_leftImg];
        [_leftImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self).offset(10);
            make.width.equalTo(@22);
            make.height.equalTo(@22);
        }];
        
        _label = [UILabel new];
        _label.text = @"头像";
        _label.textColor = ColorFrom16(0x333333);
        _label.font = PFRFONT(14);
        [self addSubview:_label];
        [_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_leftImg.mas_centerY);
            make.left.equalTo(_leftImg.mas_right).offset(15);
            make.width.greaterThanOrEqualTo(@40);
            make.height.equalTo(@20);
        }];
        
        
        _textfield = [UITextField new];
        _textfield.hidden = YES;
        [_textfield setValue:ColorFrom16A(0x757982, 1) forKeyPath:@"_placeholderLabel.textColor"];//通过kvc去改变占位符的字体颜色
        [_textfield setValue:PFRFONT(14) forKeyPath:@"_placeholderLabel.font"];
        _textfield.autocorrectionType = UITextAutocorrectionTypeNo;
        _textfield.textColor = ColorFrom16(0x757982);
        _textfield.font = PFRFONT(14);
        _textfield.textAlignment = 2;
        [self addSubview:_textfield];
        [_textfield mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self).offset(-36);
            make.height.equalTo(@20);
            make.width.greaterThanOrEqualTo(@48);
        }];
        
        _maleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _maleBtn.hidden = YES;
        [_maleBtn setTitle:@"男" forState:0];
        [_maleBtn setImage:IMAGE(@"mine_male") forState:0];
        _maleBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
        [_maleBtn setTitleColor:ColorFrom16(0x2A2F33) forState:0];
        _maleBtn.layer.backgroundColor = ColorFrom16(0xF7F7F7).CGColor;
        _maleBtn.layer.cornerRadius = 12;
        _maleBtn.titleLabel.font = PFRFONT(14);
        [self addSubview:_maleBtn];
        [_maleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self).offset(-106);
            make.width.equalTo(@60);
            make.height.equalTo(@24);
        }];
        
        _famaleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _famaleBtn.hidden = YES;
        [_famaleBtn setTitle:@"女" forState:0];
        _famaleBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
        [_famaleBtn setImage:IMAGE(@"mine_famale") forState:0];
        [_famaleBtn setTitleColor:ColorFrom16(0x2A2F33) forState:0];
        _famaleBtn.layer.backgroundColor = ColorFrom16(0xFEDE6D).CGColor;
        _famaleBtn.layer.cornerRadius = 12;
        _famaleBtn.titleLabel.font = PFRFONT(14);
        [self addSubview:_famaleBtn];
        [_famaleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(_maleBtn.mas_right).offset(10);
            make.width.equalTo(@60);
            make.height.equalTo(@24);
        }];
        
        _dateLabel = [UILabel new];
        _dateLabel.text = @"1997.06.20";
        _dateLabel.textColor = ColorFrom16(0x757982);
        _dateLabel.font = PFRFONT(14);
        _dateLabel.textAlignment = 2;
        _dateLabel.hidden = YES;
        [self addSubview:_dateLabel];
        [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self).offset(-36);
            make.width.equalTo(@90);
            make.height.equalTo(@20);
        }];
        
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
